import os

import yaml
from autoTest_prtcApi.utils.get_path import get_dataFile_path


# 读取yaml文件内容
def read_yaml(filename):
    path = get_dataFile_path("datas",filename)
    with open(path, 'r', encoding='utf-8') as f:
        return yaml.safe_load(f)

# 写入yaml文件内容
def write_yaml(filename,user_data):
    path = get_dataFile_path("datas",filename)
    with open(path, 'w', encoding='utf-8') as f:
        # 将数据写入yaml文件
        return yaml.dump(user_data,f,allow_unicode=True)


if __name__ == '__main__':
    content = {"userId":'123',"token": 'dfbgdff23'}
    write_yaml('temp.yaml', content)
